//
// Created by lucy on 1/18/2024.
//

#ifndef OOP_MUTABLE_CONTAINER_MUTABLECONTAINER_H
#define OOP_MUTABLE_CONTAINER_MUTABLECONTAINER_H

#include <iostream>
#include <sstream>
template <typename E>
class MutableContainer
{
public:
    virtual bool validIndex(int index) = 0;

    virtual void add(E ele) = 0;

    virtual void add(int index, E ele) = 0;

    // 返回移除前的值
    virtual E remove(int index) = 0;

    virtual bool removeElement(E ele) = 0;

    virtual void clear() = 0;

    // 返回值：覆盖前的元素值
    virtual E set(int index, E ele) = 0;

    virtual E get(int index) = 0;

    virtual void sort() = 0;

    virtual int index(E ele) = 0;

    virtual std::string str() = 0;

    virtual int length() = 0;

    virtual ~MutableContainer() = default;
};

#endif // OOP_MUTABLE_CONTAINER_MUTABLECONTAINER_H
